package com.lrkj.payfee.controller;

import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.Api;
import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.lrkj.common.annotation.Log;
import com.lrkj.common.core.controller.BaseController;
import com.lrkj.common.core.domain.AjaxResult;
import com.lrkj.common.enums.BusinessType;
import com.lrkj.payfee.domain.HandAdvice;
import com.lrkj.payfee.service.IHandAdviceService;
import com.lrkj.common.utils.poi.ExcelUtil;
import com.lrkj.common.core.page.TableDataInfo;

/**
 * 交班付款明细Controller
 *
 * @author yajun_ren
 * @date 2022-03-31
 */
@RestController
@RequestMapping("/payfee/HandAdvice")
@Api(tags = "交班付款明细")
public class HandAdviceController extends BaseController
{
    @Autowired
    private IHandAdviceService handAdviceService;

    /**
     * 查询交班付款明细列表
     */
    @ApiOperation(value = "查询交班付款明细列表", notes = "查询交班付款明细列表")
    @PreAuthorize("@ss.hasPermi('payfee:HandAdvice:list')")
    @GetMapping("/list")
    public TableDataInfo list(HandAdvice handAdvice)
    {
        startPage();
        this.changeParameter(handAdvice.getParams());
        List<HandAdvice> list = handAdviceService.selectHandAdviceList(handAdvice);
        return getDataTable(list);
    }

    /**
     * 导出交班付款明细列表
     */
	@ApiOperation(value = "导出交班付款明细列表", notes = "导出交班付款明细列表")
    @PreAuthorize("@ss.hasPermi('payfee:HandAdvice:export')")
    @Log(title = "交班付款明细", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(HandAdvice handAdvice)
    {
        List<HandAdvice> list = handAdviceService.selectHandAdviceList(handAdvice);
        ExcelUtil<HandAdvice> util = new ExcelUtil<HandAdvice>(HandAdvice.class);
        return util.exportExcel(list, "交班付款明细数据");
    }

    /**
     * 获取交班付款明细详细信息
     */
	@ApiOperation(value = "获取交班付款明细详细信息", notes = "获取交班付款明细详细信息")
    @PreAuthorize("@ss.hasPermi('payfee:HandAdvice:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id)
    {
        return AjaxResult.success(handAdviceService.selectHandAdviceById(id));
    }

    /**
     * 新增交班付款明细
     */
    @ApiOperation(value = "新增交班付款明细", notes = "新增交班付款明细")
    @PreAuthorize("@ss.hasPermi('payfee:HandAdvice:add')")
    @Log(title = "交班付款明细", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody HandAdvice handAdvice)
    {
        return toAjax(handAdviceService.insertHandAdvice(handAdvice));
    }

    /**
     * 修改交班付款明细
     */
    @ApiOperation(value = "修改交班付款明细", notes = "修改交班付款明细")
    @PreAuthorize("@ss.hasPermi('payfee:HandAdvice:edit')")
    @Log(title = "交班付款明细", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody HandAdvice handAdvice)
    {
        return toAjax(handAdviceService.updateHandAdvice(handAdvice));
    }

    /**
     * 删除交班付款明细
     */
    @ApiOperation(value = "删除交班付款明细", notes = "删除交班付款明细")
    @PreAuthorize("@ss.hasPermi('payfee:HandAdvice:remove')")
    @Log(title = "交班付款明细", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable String[] ids)
    {
        return toAjax(handAdviceService.deleteHandAdviceByIds(ids));
    }
}
